package com.hujiheng.paike.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.sql.Date;
import java.text.DateFormat;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student {
    private int studentId;
    private int classId;
    @NotBlank(message = "学生姓名不能为空")
    private String studentName;
    @NotBlank(message = "学生性别不能为空")
    private String studentSex;
    private Date studentBirthday;

    public Student(int classId, String studentName, String studentSex, Date studentBirthday) {
        this.classId = classId;
        this.studentName = studentName;
        this.studentSex = studentSex;
        this.studentBirthday = studentBirthday;
    }

    @Override
    public String toString() {
        return "Student{" +
                "studentId=" + studentId +
                ", classId=" + classId +
                ", studentName='" + studentName + '\'' +
                ", studentSex='" + studentSex + '\'' +
                ", studentBirthday=" + DateFormat.getDateInstance(DateFormat.MEDIUM).format(studentBirthday) +
                '}';
    }
}
